import * as actions from '../actions'

const productInitialState = {data:[]}
const products = (state = productInitialState, action) => {
  switch (action.type) {
    case actions.SET_PRODUCTS:
      console.log('action products:', action.products)
      return {
        ...action.products
      }
    case actions.ADD_PRODUCTS:
      state.list.push(action.product)
      return {
        ...state
      }
    default:
      return state
  }
}

export default products;
